package cn.longg.mapper;

import cn.longg.entity.Article;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface ArticleMapper extends Mapper<Article> {
    @SelectProvider(value = ArticleMapperSqlProvider.class,method = "selectByPage")
    List<Article> selectByPage(String title);


    @Update("update article set browse_count = browse_count + 1 where id = #{id}")
    int browseIncr(Integer id);

    @SelectProvider(value = ArticleMapperSqlProvider.class,method = "selectFavByPage")
    List<Article> selectFavByPage(@Param("title")String title,@Param("uId") Integer uId);
}